<?php
namespace Mob\Model;

use Think\Model;
use Think\Hook;

/**数据字典模型
 * Class InfoModel
 */


class EnterpriseModel extends Model
{

   public function creator($name,$imgpath,$industry,$grade,$intro)
   {
    $data['name']=$name;
    $data['intro']=$intro;
    $data['imgPath']=$imgpath;
    $data['industry']=$industry;
    $data['grade']=$grade;
    $data['createUid']=get_uid();
    return $this->add($data);
   }


   public function updateLogoImg($eId,$imgpath)
   {

  return  $this->where(array('Id'=>$eId))->save(array('imgPath'=>$imgpath));


   }
   public function updateInfo($eId,$data)
   {
   return  $this->where(array('Id'=>$eId))->save($data);
   }
   public function get_EnterpriseInfo($eId)
   {
   return  $this->where(array('Id'=>$eId))->field('Id,name,intro,status,createTime,imgPath,industry,grade,sortId')->find();

   }
   public function get_AllEnterprise()
   {
    return  $this->where(array('status'=>1))->field('Id,name,intro,status,createTime,imgPath,industry,grade,sortId')->select();


   }
   public function get_NameForId($industryId,$Ename)
   {
   	$where = array('industry'=>$industryId,'name'=>$Ename,'status'=>1);

   return $this->where($where)->field('industry,status,name,Id')->find()['Id'];

   }





}